package com.web.all.common.bean.enums;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;

/**
 * 数据状态枚举
 *
 * @author zhangchongyang
 */
public enum StatusEnum {

    /**
     * 正常
     */
    NORMAL(1),

    /**
     * 锁定/禁用
     */
    LOCK(0),

    /**
     * 已删除
     */
    DELETED(-1);

    public final Integer value;
    StatusEnum(Integer value) {
        this.value = value;
    }
    private static Map<Integer,StatusEnum> statusLoop = new HashMap<>();

    static {
        Stream.of(StatusEnum.values()).forEach(statusEnum -> statusLoop.put(statusEnum.value,statusEnum));
    }
    public static StatusEnum forCode(Integer value){
        return statusLoop.get(value);
    }
}
